package com.study.lxy.zookeeper.watcher;

import com.study.lxy.zookeeper.RealTimeConfigUtils;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RealTimeConfigWatcher implements Watcher {

    private static final Logger logger = LoggerFactory.getLogger(RealTimeConfigWatcher.class);

    public void process(WatchedEvent watchedEvent) {
        if(Event.EventType.NodeDataChanged == watchedEvent.getType()){
            logger.info("realTime config data changed");
            RealTimeConfigUtils.getInstances().load();
        }
    }
}
